package com.tao.mapper;

import com.github.pagehelper.Page;
import com.tao.annotation.AutoFill;
import com.tao.enumeration.OperationType;
import com.tao.pojo.dto.LoginDto;
import com.tao.pojo.dto.PageSelectUserDto;
import com.tao.pojo.entity.User;
import com.tao.pojo.vo.UserVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from user where name=#{name} ")
    public User loginMapper(LoginDto loginDto);

    @AutoFill(value = OperationType.INSERT)
    public void userAddMapper(User user);

    public Page<UserVo> pageSelectUserMapper(PageSelectUserDto pageSelectUserDto);

    @AutoFill(value = OperationType.UPDATE)
    public void updateUserMapper(User user);

    @Select("select * from user where id=#{id}")
    public User getUserByIdMapper(Integer id);

    @Update("update user set status=#{newStatus} where id=#{id}")
    public void updateStatus(Integer newStatus,Integer id);


    public void deleteUser(List<Integer> ids);


}
